import time


def get_logger():
    try:
        from loguru import logger
    except Exception as e:
        import pip
        pip.main(["install", "--user", "loguru"])
        from loguru import logger
        print(f'pip install loguru')
    # out_p = 'C:\zxc\data\shwj'
    out_p = './doc/log'
    # out_p = 'D:\code\git\zxc\huoni\shwj_honey'
    t = str(time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()))
    logFile="%s/run_%s_%s.log" % (out_p, 'progname', t)
    #logger.add(logFile, rotation='200KB', compression='zip', retention="72h")
    logger.add(logFile, rotation='1024KB')

    return logger


logger = get_logger()
# print = logger.info

if __name__ =='__main__':
    # test_HuoniMessClient()
    logger.info('test log info')